<h1><span class="reg_ico"></span><?= lang('label_edit_profile'); ?></h1>

<ul class="breadcrumb">
    <li><a href="<?= base_url() ?>"><?= lang('label_home') ?></a></li>
    <li><a href="<?= base_url('user/profile') ?>"><?= lang('label_profile') ?></a></li>
    <li><?= lang('label_edit_profile'); ?></li>
</ul>


<div class="page">
    <form class="forms inside_1" action="<?php echo current_url() ?>" method="post">


        <div class="text">
            <label for="fname"><?php echo lang('label_fname') ?> :</label>
            <samp>
                <input type="text" name="fname" id="fname" placeholder="<?php echo lang('label_fname') ?>" class="input-user" value="<?= (form_val('fname')) ? form_val('fname') : $user->first_name ?>" />
            </samp>
        </div>
        
        <div class="text">
            <label for="mname"><?php echo lang('label_mname') ?> :</label>
            <samp>
                <input type="text" name="mname" id="mname" placeholder="<?php echo lang('label_mname') ?>" class="input-user" value="<?= (form_val('mname')) ? form_val('mname') : $user->middle_name ?>" />
            </samp>
        </div>
        
        <div class="text">
            <label for="lname"><?php echo lang('label_lname') ?> :</label>
            <samp>
                <input type="text" name="lname" id="lname" placeholder="<?php echo lang('label_lname') ?>" class="input-user" value="<?= (form_val('lname')) ? form_val('lname') : $user->last_name ?>" />
            </samp>
        </div>
        
        <div class="radio">
            <label for="lname"><?php echo lang('label_gender') ?> :</label>
            <samp>
                <input type="radio" name="gender" id="male" value="male" <?php if (form_val('gender') == 'male') {
                    echo 'checked';
                } else {
                    if ($user->gender == 'MA') echo 'checked';
                } ?> /><label for="male"><?php echo lang('label_male') ?></label>
            </samp>
            <samp>
                <input type="radio" name="gender" id="female" value="female" <?php if (form_val('gender') == 'female') {
                    echo 'checked';
                } else {
                    if ($user->gender == 'FE') echo 'checked';
                } ?> /><label for="female"><?php echo lang('label_female') ?></label>
            </samp>
        </div>

        <div class="select">
            <label><?php echo lang('label_birthday') ?> :</label>
            <samp style="min-width: 100px;">
                <select name="day" id="day" style="width: 100px">
                    <?php for ($i = 1; $i <= 31; $i++) { ?>
                        <option value="<?= $i ?>" <?php if (form_val('day') == $i) {
                        echo 'selected';
                    } else {
                        if ($user->day == $i) echo 'selected';
                    } ?>><?= $i ?></option>
                    <?php } ?>
                </select>
            </samp>
            <samp style="min-width: 123px">
                <select name="month" id="month" style="width: 123px">
<?php for ($i = 1; $i <= 12; $i++) { ?>
                        <option value="<?= $i ?>" <?php if (form_val('month') == $i) {
        echo 'selected';
    } else {
        if ($user->month == $i) echo 'selected';
    } ?>><?= lang('label_m' . $i) ?></option>
<?php } ?>
                </select>
            </samp>
            <samp style="min-width: 95px">
                <select name="year" id="year" style="width:95px">
                    <?php
                    for ($i = 0; $i < 80; $i++) {
                        $date = date('Y') - ($i + 16);
                        ?>
                        <option value="<?= $date ?>" <?php if (form_val('year') == $date) {
                            echo 'selected';
                        } else {
                            if ($user->year == $date) echo 'selected';
                        } ?>><?= $date ?></option>
<?php } ?>
                </select>
            </samp>
        </div>
        
        <div class="select">
            <label for="city">
                <?php echo lang('label_city') ?> :
            </label>
            <samp>
                <select name="city" id="city">
<?php foreach ($cities as $ct) { ?>
                        <option value="<?= $ct->id ?>" <?php if (form_val('city') == $ct->id) {
                            echo 'selected';
                        } else {
                            if ($user->city_id == $ct->id) echo 'selected';
                        } ?>><?= $ct->title ?></option>
<?php } ?>
                </select>
            </samp>
        </div>
        
        <div class="text">
            <label for="mobile">
<?php echo lang('label_mobile') ?> :
            </label>
            <samp>
                <input name="mobile" id="mobile" placeholder="<?php echo lang('label_mobile') ?>" value="<?= (form_val('mobile')) ? form_val('mobile') : $user->mobile ?>" type="number" />
            </samp>
        </div>

        <div class="text">
            <label for="email">
<?php echo lang('label_email') ?> :
            </label>
            <samp>
                <input name="email" id="email" placeholder="<?php echo lang('label_email') ?>" value="<?= (form_val('email')) ? form_val('email') : $user->email ?>" type="email" />
            </samp>  

        </div>

        <div class="text">
            <label for="oldpassword">
<?php echo lang('label_old_password') ?> :
            </label>
            <samp>
                <input name="oldpassword" id="oldpassword" placeholder="<?php echo lang('label_old_password') ?>" type="password" />
            </samp>
        </div>

        <div class="text">
            <label for="password">
<?php echo lang('label_new_password') ?> :
            </label>
            <samp>
                <input name="password" id="password" placeholder="<?php echo lang('label_new_password') ?>" type="password" />
            </samp>
        </div>
        <div class="text">
            <label for="confpassword">
<?php echo lang('label_confpassword') ?> :
            </label>
            <samp>
                <input name="confpassword" id="confpassword" placeholder="<?php echo lang('label_confpassword') ?>" type="password" />
            </samp>
        </div>

        <div class="checkbox">
            <samp>
                <input type="checkbox" name="subscrib" id="subscrib" <?php if (form_val('subscrib')) {
                            echo 'checked';
                        } else {
                            if ($user->subscrib == 'YES') echo 'checked';
                        } ?> /><label for="subscrib"><?php echo lang('label_subscrib') ?></label>
            </samp>
        </div>

        <div class="submit">
            <input name="submit" value="<?= lang('label_edit_profile') ?>" type="submit"  >
        </div>
        
    </form>
</div>